﻿// -----------------------------------------------------------------------
// <copyright file="Bootstrapper.cs" company="CompDJ">
//     Copyright (c) CompDJ. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------

namespace T4DemoCs
{
    using System;
    using System.Collections.Generic;
    using GalaSoft.MvvmLight;
    using GalaSoft.MvvmLight.Ioc;

    /// <summary>SimpleIoc Boot Strapper class.</summary>
    public static class Bootstrapper
    {
        /// <summary>Initializes static members of the Bootstrapper class.</summary>
        static Bootstrapper()
        {
            ConfigureContainer();
        }

        /// <summary>Resolves a type.</summary>
        /// <typeparam name="T">Type to resolve</typeparam>
        /// <returns>Returns an instance of the type</returns>
        public static T Resolve<T>()
        {
            return SimpleIoc.Default.GetInstance<T>();
        }

        /// <summary>Resolves a type.</summary>
        /// <typeparam name="T">Type to resolve</typeparam>
        /// <param name="key">Key for object construction</param>
        /// <returns>Returns an instance of the type</returns>
        public static T Resolve<T>(string key)
        {
            return SimpleIoc.Default.GetInstance<T>(key);
        }

        /// <summary>Creates the builder and registers the types for the application.</summary>
        private static void ConfigureContainer()
        {
            SimpleIoc.Default.Register<ViewModel.MainViewModel>();
        }
    }
}
